package com.wangyadong.hobby.schedule.jobtask.map;

import com.wangyadong.hobby.schedule.jobtask.tree.pq.Entry;

/**
 * <p>
 *
 * @author <714037465@qq.com>
 * @since 2018/9/1116:54
 **/
public interface Map<K, V> {
    int size();

    boolean isEmpty();

    V get(K k);

    V put(K k, V v);

    Iterable<K> keySet();

    Iterable<V> values();

    Iterable<Entry<K, V>> entrySet();

    public static void main(String[] args) {
        Integer integer=50;
        System.out.printf("%-10d %32s\n", integer, Integer.toBinaryString((integer)));
        System.out.printf("%-10d %32s\n", integer>>>27, Integer.toBinaryString((integer>>>27)));
        System.out.printf("%-10d %32s\n", integer<<5, Integer.toBinaryString((integer<<5)));
        System.out.printf("%-10d %32s\n", integer<<5|integer>>>27, Integer.toBinaryString((integer<<5|integer>>>27)));
        System.out.println("==========================================");
        String str = "o989asdadsdad";
        System.out.println((1 << 5));
        System.out.println((111 >>> 27));
        System.out.println((1 << 5)|(111 >>> 27));
        System.out.println(hashCode(str));

    }

    public static int hashCode(String s) {
        int h = 0;
        for (int i = 0; i < s.length(); i++) {
            h = (h << 5) | (h >>> 27); // 5-bit cyclic shift of the running sum
            h += (int) s.charAt(i); // add in next character
        }
        return h;
    }

}
